<%@ Page language="c#" Inherits="hemsidan.ViewGallery" CodeFile="ViewGallery.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD runat="server">
		<script src="scripts/PhotoGallery.js" type="text/jscript"></script>
  </HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<div id="galleryHeader">
				<asp:Label id="lblGalleryHeader" runat="server"></asp:Label>
			</div>
			<div id="leftScroll">
				<asp:DataList id="dlImages" runat="server" DataKeyField="Id">
                    <SelectedItemStyle CssClass="Selected">
                    </SelectedItemStyle>
                    <ItemTemplate>
						    <img src='<%# DataBinder.Eval(Container.DataItem, "Path") %>' class="GalleryTN"/>
                    </ItemTemplate>
				</asp:DataList>
			</div>
			<div id="display">
				<asp:Image ID="imgDisplay" runat="server"></asp:Image>
			</div>
		</form>
	</body>
<script>

function initGallerImages()
{
	for (var i = 0; i < document.images.length; i++)
	{
		if (document.images[i].className=="GalleryTN")
		{
		    document.images[i].onclick=SwitchPicture;
		}
	}
}

function SwitchPicture(){
    var img = document.getElementById("imgDisplay");
    img.src = event.srcElement.src;
}

initGallerImages();

</script>
</HTML>
